package com.hzw.saas.api.group.bo;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.hzw.saas.api.storage.bo.ResourceFileBO;
import cn.hutool.core.collection.CollectionUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * @author EZ09
 * @since 07/19/2021
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel("群组文件")
public class GroupResourceBO extends ResourceFileBO {

    private static final long serialVersionUID = 1L;

    /**
     * 共享的群组
     */
    @ApiModelProperty(value = "共享群组ID列表", position = 91)
    protected List<String> groupIds = new ArrayList<>();

    /**
     * 增加分享的群组id
     *
     * @param groupIds 分享的群组ID
     * @return 群组列表
     */
    public void addGroupIds(String... groupIds) {
        if (this.groupIds == null) {
            this.groupIds = new ArrayList<>();
        }
        this.groupIds.addAll(Arrays.asList(groupIds));
    }

    /**
     * 增加分享的群组id
     *
     * @param groupIds 分享的群组ID
     * @return 群组列表
     */
    public void addGroupIds(List<String> groupIds) {
        if (this.groupIds == null) {
            this.groupIds = new ArrayList<>();
        }
        if (CollectionUtil.isEmpty(groupIds))
            return;
        this.groupIds.addAll(groupIds);
    }

}
